<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_Donneeregionals extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Iddonneeregionals;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Idformatfichier;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Idfeuilleprojet;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_Valeurcol;


    /**
     * Parent relation fk_donneeregionals_feuilleprojet1
     *
     * @var Application_Model_Feuilleprojet
     */
    protected $_Feuilleprojet;

    /**
     * Parent relation fk_donneeregionals_formatfichier1
     *
     * @var Application_Model_Formatfichier
     */
    protected $_Formatfichier;


    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'iddonneeregionals'=>'Iddonneeregionals',
            'idformatfichier'=>'Idformatfichier',
            'idfeuilleprojet'=>'Idfeuilleprojet',
            'valeurcol'=>'Valeurcol',
        ));

        $this->setParentList(array(
            'FkDonneeregionalsFeuilleprojet1'=> array(
                    'property' => 'Feuilleprojet',
                    'table_name' => 'Feuilleprojet',
                ),
            'FkDonneeregionalsFormatfichier1'=> array(
                    'property' => 'Formatfichier',
                    'table_name' => 'Formatfichier',
                ),
        ));

        $this->setDependentList(array(
        ));
    }

    /**
     * Sets column iddonneeregionals
     *
     * @param int $data
     * @return Application_Model_Donneeregionals
     */
    public function setIddonneeregionals($data)
    {
        $this->_Iddonneeregionals = $data;
        return $this;
    }

    /**
     * Gets column iddonneeregionals
     *
     * @return int
     */
    public function getIddonneeregionals()
    {
        return $this->_Iddonneeregionals;
    }

    /**
     * Sets column idformatfichier
     *
     * @param int $data
     * @return Application_Model_Donneeregionals
     */
    public function setIdformatfichier($data)
    {
        $this->_Idformatfichier = $data;
        return $this;
    }

    /**
     * Gets column idformatfichier
     *
     * @return int
     */
    public function getIdformatfichier()
    {
        return $this->_Idformatfichier;
    }

    /**
     * Sets column idfeuilleprojet
     *
     * @param int $data
     * @return Application_Model_Donneeregionals
     */
    public function setIdfeuilleprojet($data)
    {
        $this->_Idfeuilleprojet = $data;
        return $this;
    }

    /**
     * Gets column idfeuilleprojet
     *
     * @return int
     */
    public function getIdfeuilleprojet()
    {
        return $this->_Idfeuilleprojet;
    }

    /**
     * Sets column valeurcol
     *
     * @param text $data
     * @return Application_Model_Donneeregionals
     */
    public function setValeurcol($data)
    {
        $this->_Valeurcol = $data;
        return $this;
    }

    /**
     * Gets column valeurcol
     *
     * @return text
     */
    public function getValeurcol()
    {
        return $this->_Valeurcol;
    }

    /**
     * Sets parent relation Idfeuilleprojet
     *
     * @param Application_Model_Feuilleprojet $data
     * @return Application_Model_Donneeregionals
     */
    public function setFeuilleprojet(Application_Model_Feuilleprojet $data)
    {
        $this->_Feuilleprojet = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idfeuilleprojet'];
        }

        $this->setIdfeuilleprojet($primary_key);

        return $this;
    }

    /**
     * Gets parent Idfeuilleprojet
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_Feuilleprojet
     */
    public function getFeuilleprojet($load = true)
    {
        if ($this->_Feuilleprojet === null && $load) {
            $this->getMapper()->loadRelated('FkDonneeregionalsFeuilleprojet1', $this);
        }

        return $this->_Feuilleprojet;
    }

    /**
     * Sets parent relation Idformatfichier
     *
     * @param Application_Model_Formatfichier $data
     * @return Application_Model_Donneeregionals
     */
    public function setFormatfichier(Application_Model_Formatfichier $data)
    {
        $this->_Formatfichier = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idformatfichier'];
        }

        $this->setIdformatfichier($primary_key);

        return $this;
    }

    /**
     * Gets parent Idformatfichier
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_Formatfichier
     */
    public function getFormatfichier($load = true)
    {
        if ($this->_Formatfichier === null && $load) {
            $this->getMapper()->loadRelated('FkDonneeregionalsFormatfichier1', $this);
        }

        return $this->_Formatfichier;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_Donneeregionals
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_Donneeregionals());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_Donneeregionals::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIddonneeregionals() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('iddonneeregionals = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIddonneeregionals()));
    }
}
